#include <iostream>
#include <vector>
using namespace std;

int cal_method(vector<int>& a, int n, int t)
{
        if(t == 0){
                return 1;
        }

        if(n == 0){
                return 0;
        }

        int meth = cal_method(a, n-1, t);
        if(a[n] <= t){
                meth += cal_method(a, n-1, t-a[n]);
        }
        return meth;
}

int cal_method(vector<int>& a, int n, int t, vector<vector<int>>& dp)
{
        if(t == 0){
                return 1;
        }

        if(n == 0){
                return 0;
        }

        if(dp[n][t] != -1){
                return dp[n][t];
        }

        int meth = cal_method(a, n-1, t, dp);
        if(a[n] <= t){
                meth += cal_method(a, n-1, t-a[n], dp);
        }
        dp[n][t] = meth;
        return meth;
}

int cal_method_dp(vector<int>& a, int n, int t)
{
        vector<vector<int>> dp(n+1, vector<int>(t+1, 0));
        dp[0][0] = 1;
        for(int i = 1; i <= n; i++){
                dp[i][0] = 1;
                for(int j = 1; j <= t; j++){
                        dp[i][j] = dp[i-1][j];
                        if(a[i] <= j){
                                dp[i][j] += dp[i-1][j-a[i]];
                        }
                }
        }
        return dp[n][t];
}

int cal_method_dp_sp(vector<int>& a, int n, int t)
{
        vector<int> dp(t+1, 0);
        dp[0] = 1;
        for(int i = 1; i <= n; i++){
                for(int j = t; j >= a[i]; j--){
                        dp[j] += dp[j-a[i]];
                }       
        }
        return dp[t];
}

int main() 
{
        int n, t;
        cin >> n >> t;

        vector<int> a(n+1, 0);
        for (int i = 1; i <= n; i++) {
                cin >> a[i];
        }
        vector<vector<int>> dp(n+1, vector<int>(t+1, -1));
        cout<<cal_method_dp_sp(a, n, t)<<endl;
        return 0;
}